#pragma once
#include "MTypes.h"
#include "MList.h"

BEGIN_MARIONETTE

//////////////////////////////////////////////////////////////////////////
class MEnviroment:private MTypes_Imp{
public:
	MEnviroment();

	void Reset();
	void ImportFrom(MString xml);
	void ExportTo(MString& xml);
	MType* GetTypeByName(MString name);
	MStruct* NewStruct(MString structName);
	MList* NewList(MString listName);

	MValue NewValue(MString typeName,MAddress addr);
	MValue CreateValue(MString typeName,MString valueName,MAddress addr);
	MValue GetValueByName(MString valueName);



private:
	bool ValueExist( MString valueName );
	
	virtual MStruct*  CreateStruct(MString StructName);
	virtual MType* CreateList(MString name);
	virtual void CreateInnerTypes();
	void ImportValueFrom(MString xml);
	MString ExportValues();
	MString ExportTypes();
	typedef std::map<MString,MValue> MValueContainer_Type;
	MValueContainer_Type m_MValuesContainer;
};
END_MARIONETTE